<li class="field radio full reference" id="form_field_shipping_method_idShop_Order">
	<?
		$shipping_options = $this->getAvailableShippingMethods($form_model);
		
		$local_methods = array();
		foreach ($shipping_options as $index=>$option)
		{
			if (!$option->multi_option && !$option->error_hint)
			{
				$local_methods[] = $option;
				unset($shipping_options[$index]);
			}
		}
		
		$selected_shipping_option = $form_model->shipping_method_id;
		if ($form_model->shiping_sub_option_id)
			$selected_shipping_option = $form_model->shiping_sub_option_id;
	?>
	
	<div id="shipping_option_selector">
		<ul class="recordSelector">
			<? if (count($local_methods)): ?>
				<li class="header">User-defined shipping options</li>
			
				<? foreach ($local_methods as $option): ?>
					<li class="selectable <?= (int)$form_model->shipping_method_id == (int)$option->id ? 'current' : null ?>" onclick="record_selector_click(this)">
						<?= h($option->name) ?> <span class="right"><?= format_currency($option->quote) ?></span>
						<input type="hidden" value="<?= $option->id ?>"/>
					</li>
				<? endforeach ?>
			<? endif ?>
			
			<? foreach ($shipping_options as $option): 
				if (!$option->error_hint && !$option->sub_options)
					continue;
			?>
				<li class="header"><?= h($option->name) ?></li>
				<? if (!$option->error_hint): ?>
					<? foreach ($option->sub_options as $sub_option): ?>
						<li class="selectable <?= ($option->id == $form_model->shipping_method_id && $sub_option->id == $form_model->shiping_sub_option_id) ? 'current' : null ?>" onclick="record_selector_click(this)">
							<?= h($sub_option->name) ?>
							<span class="right"><?= format_currency($sub_option->quote) ?></span>
							<input type="hidden" value="<?= $sub_option->id ?>"/>
						</li>
					<? endforeach ?>
				<? else: ?>
					<li class="error"><?= h($option->error_hint) ?></li>
				<? endif ?>
			<? endforeach ?>
			
			<? if (!count($local_methods) && !count($shipping_options)): ?>
				<li class="noData">No shipping options available for the selected shipping location.</li>
			<? endif ?>
		</ul>
		<input type="hidden" class="master" name="Shop_Order[shipping_method_id]" value="<?= $selected_shipping_option ?>" id="shipping_method_id"/>
	</div>
</li>
